<template>
	<view class="content">
		<view class="toububjt" style="background-image: url(https://socialmall.yuntaiqikeji.com/uploads/20230606/f8bfad3332717b4a3401cf6339a3e48b.png);">
			<view class="xiaobtext">可提现金额（元）</view>
			<view class="margin_top2 dbaitext">￥{{totalMoney}}</view>
		</view>
		<view class="padding">
			<view class="neirong">
				<view class="padding ffffff circle margin-top">
					<view class="text_a color_three">提现金额 (元)</view>
					<view class="flexbetween margin_top">
						<view class="flexleft" style="flex: 5;">
							<view class="">￥</view>
							<input type="digit" v-model="price" placeholder="请输入提现金额" class="daheitext">
						</view>
						<view class="huangsetext" style="flex: 1.1;" @click="price=totalMoney">全部提现</view>
					</view>
				</view>
				<!-- <view class="padding ffffff circle margin_top">
					<view class="methods-item  ffffff flexbetween" @click="changeIndexJF">
						<view class="left flexcenter">
							<image src="../static/image/my/wx.png" mode="" class="wx"></image>
							<view class="name flex1">微信</view>
						</view>
						<view class="right">
							<image v-if="!activeIndexJF" src="/static/image/home/xuanzhong.png"
								style="width: 34rpx;height: 34rpx;"></image>
							<image v-if="activeIndexJF" src="/static/image/home/wiexuanzhong.png"
								style="width: 34rpx;height: 34rpx;"></image>
						</view>
					</view>
				</view> -->
				<view class="footer_btn tixian" @click="tixian">提现</view>
				<view class="text text_green jilu" @click="tixianjl">提现记录</view>
			</view>
		</view>
		<u-modal :show="show" :title="title" showCancelButton="true" confirmColor="RGBA(212, 139, 57, 1)"
			@confirm="confirm" @cancel="show=false"></u-modal>
	</view>
</template>
<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				show: false,
				title: "您确定要提现吗？",
				activeIndexJF: false, // 是否使用微信
				totalMoney: "",
				price: ""
			}
		},
		onLoad() {
			this.getUserInfo()
		},
		methods: {
			tixian() {
				if (this.price == "") {
					httpRequest.toast("提现金额不能为空!");
					return false
				}
				this.show = true
			},
			confirm() {
				let _this = this
				httpRequest.request('/api/user/addWithdrawal', 'GET', {
					price: _this.price
				}).then(res => {
					if (res.code == 1) {
						httpRequest.toast(res.msg);
						setTimeout(()=>{
							uni.navigateBack(1)
						},500)
					} else if (res.code == 0) {
						httpRequest.toast(res.msg);
					} else {
						httpRequest.toast('网络开小差啦');
					}
					this.show = false
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
			tixianjl() { //提现记录
				uni.navigateTo({
					url: "/pages_my/tixianjl"
				})
			},
			changeIndexJF() {
				this.activeIndexJF = !this.activeIndexJF
			},
			getUserInfo() { //余额
				let _this = this
				httpRequest.request('/api/user/index', 'GET', {

				}).then(res => {
					if (res.code == 1) {
						_this.totalMoney = res.data.money
					} else if (res.code == 0) {
						httpRequest.toast(res.msg);
					} else {
						httpRequest.toast('网络开小差啦');
					}
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	view.text1 {
		font-size: 28rpx;
		text-align: center;
		font-weight: normal;
		color: #d48b39;
	}

	.methods-item {
		padding-left: 0;
		padding-right: 0;
		border-bottom: 2rpx solid #fafafa;
	}

	.methods-item:last-child {
		border-bottom: 0;
	}

	.wx {
		width: 36rpx;
		height: 36rpx;
		background-size: 100% 100%;
		margin-right: 4rpx;
		margin-left: 4rpx;
	}

	.tixian {
		margin-top: 170rpx;
	}

	.jilu {
		margin-top: 20rpx;
		font-size: 32rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #d48b39;
	}

	.circle {
		border-radius: 32rpx 24rpx 43rpx 42rpx;
	}

	.huangsetext {
		font-size: 28rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #d48b39;
	}

	.neirong {
		position: relative;
		top: -140rpx;
	}

	.dbaitext {
		font-size: 40rpx;
		font-family: PingFang SC-Heavy, PingFang SC;
		font-weight: 800;
		color: #FFFFFF;
	}

	.xiaobtext {
		font-size: 24rpx;
		font-family: PingFang SC-Heavy, PingFang SC;
		font-weight: 800;
		color: #FFFFFF;
	}

	.toububjt {
		background-size: 100% 100%;
		width: 100%;
		padding: 20rpx 30rpx 0;
		height: 258rpx;
		box-sizing: border-box;
	}

	.daheitext {
		font-size: 40rpx;
		font-family: DIN Next LT Pro-Regular, DIN Next LT Pro;
		font-weight: 400;
		color: #333333;
	}

	.footer_btn {
		font-size: 32rpx;
		font-weight: 500;
		color: #FFFFFF;
		text-align: center;
		padding: 20rpx 20rpx;
		background-color: #d48b39;
		border-radius: 64rpx;
	}

	.wx {
		width: 32rpx;
		height: 32rpx;
		background-size: 100% 100%;
		margin-right: 10rpx;
	}
</style>